package model.bo;

import static org.junit.Assert.*;

import org.junit.Test;

public class EmprestimoBOTestTaxaJuros {

	EmprestimoBO emprestimo;
	
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreUmETresValorMinimo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 1;
    	double taxaEsperada = 0.05;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
	
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreUmETresValorMaximo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 3;
    	double taxaEsperada = 0.05;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreQuatroEDezValorMinimo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 4;
    	double taxaEsperada = 0.065;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreQuatroEDezValorMaximo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 10;
    	double taxaEsperada = 0.065;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreQuatroEDezValorInterno(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 6;
    	double taxaEsperada = 0.065;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreOnzeEQuinzeValorMinimo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 11;
    	double taxaEsperada = 0.08;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreDezEQuinzeValorMaximo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 15;
    	double taxaEsperada = 0.08;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreDezEQuinzeValorInterno(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 13;
    	double taxaEsperada = 0.08;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreDezesseisEVinteEQuatroValorMinimo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 16;
    	double taxaEsperada = 0.10;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
    
    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreDezesseisEVinteEQuatroValorMaximo(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 24;
    	double taxaEsperada = 0.10;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }

    @Test
    public void getTaxaJurosTesteQuandoPrestacaoEEntreDezesseisEVinteEQuatroValorInterno(){
    	
    	//ARRANGE
    	
    	int numPrestacoes = 20;
    	double taxaEsperada = 0.10;
    	
    	//ACT
    	double taxa=emprestimo.getInstance().getTaxaJuros(numPrestacoes);
    	
    	
    	//ASSERT
    	
    	assertEquals(taxaEsperada,taxa,0 );
    }
}
